<template>
  <section>
    <el-tabs tab-position="left" v-model="selMethod" @tab-click="handleClick" style="height: 180px">
      <el-tab-pane label="账户密码"  name="account">
        <account-login v-if="selMethod === 'account'" v-on:loginSuccess="loginSuccess"/>
      </el-tab-pane>
      <!--<el-tab-pane label="邮箱"  name="email">-->
        <!--<email-login v-if="selMethod === 'email'"  v-on:loginSuccess="loginSuccess"/>-->
      <!--</el-tab-pane>-->
      <el-tab-pane label="手机验证码"  name="phone">
        <phone-login  v-if="selMethod === 'phone'"  v-on:loginSuccess="loginSuccess"/>
      </el-tab-pane>
    </el-tabs>
    <el-row>
      第三方登录：
    </el-row>
  </section>
</template>

<script>
  // import {mapActions,mapGetters} from 'vuex'
  import phoneLogin from './phoneLogin'
  import accountLogin from './accountLogin'
  import { createNamespacedHelpers, mapMutations } from 'vuex'
  const { mapState, mapMutations, mapActions } = createNamespacedHelpers(process.env.VUE_APP_MODULE_TITLE)
  export default {
    name: "loginForm",
    components:{accountLogin,phoneLogin},
    data(){
      return{
        selMethod:'account'
      }
    },
    methods:{
      ...mapActions([
        'login'
        ]),
      handleClick(e){
        console.log('选了-----',e)
      },
      loginSuccess(res){
        console.log('看下map-----------',mapMutations)
        this.login( res.token)
        this.$router.push('/team-management')
        // this.getMemberInfor()
      },
      getMemberInfor(){
        console.log('getmemberinfor')
        let that=this
        this.fetch({
          api:'/user/member/getSelfInfo',
          success:res=>{
            console.log('memberInfor---------',res)
            that.$store.commit('SET_MEMBERINFO',res)
            that.$emit('successEvent') //this.$router.push('/team-management')
          }
        })
      },
    }
  }
</script>

<style scoped>

</style>
